//
//  UIImageView+category_CCKit.m
//  CCKit
//
//  Created by tucici on 2019/3/18.
//  Copyright © 2019 tucici. All rights reserved.
//

#import "UIImageView+category_CCKit.h"

@implementation UIImageView (category_CCKit)
- (CGSize)getFixSizeWithSize:(CGSize)size;
{
    if (!self.image) return CGSizeZero;
    CGFloat scale_widht = self.image.size.width * 1.0 / size.width;
    CGFloat scale_height = self.image.size.height * 1.0 /size.height;
    CGFloat scale = MAX(scale_widht, scale_height);
    
    return CGSizeMake(self.image.size.width * 1.0 / scale, self.image.size.height * 1.0 / scale);
}

- (CGSize)getFixSizeWithH:(CGFloat)H
{
    if (!self.image) return CGSizeZero;
    CGFloat scale_widht = self.image.size.width * 1.0 / H;
    CGFloat scale_height = self.image.size.height * 1.0 / H;
    CGFloat scale = MAX(scale_widht, scale_height);
    
    return CGSizeMake(self.image.size.width * 1.0 / scale, self.image.size.height * 1.0 / scale);
}
@end
